<template>
  <div>
    <code>
      <svg-icon icon-class="message" style="margin-right:10px;color:red;font-size:20px;"></svg-icon>
      备注：免运费条件
    </code>
    <p class="c-mh16"><label for="">满:</label>
      <el-input v-model="mallConfig.freeShipping" clearable placeholder="请输入金额"
                style="margin: 0 5px;" class="width110"></el-input>
      元免运费（可不填）
    </p>
    <p v-if="permission == 3" style="width: 500px;text-align: center;">
      <el-button type="primary" icon="el-icon-check" @click="save('postage')">保存</el-button>
    </p>
  </div>
</template>
<script>
  export default {
    props: ['mallConfig', 'permission'],
    methods: {
      save(msg) {
        if(isNaN(this.mallConfig.freeShipping) || Number(this.mallConfig.freeShipping) < 0) {
          this.$message({
            message: '运费金额应该为数值, 且不能为负数',
            type: 'error'
          })
          return
        }
        this.$emit('save', msg)
      }
    }
  }
</script>
<style scoped>
  label {
    font-weight: 500;
    font-size: 14px;
    display: inline-block;
    width: 110px;
    text-align: right;
    margin-right: 20px;
  }
</style>
